<template>
  <div>
    <!-- 搜索框 -->
    <van-search :value="value" v-model="value" placeholder="春季"/>
    <!-- 商品列表模块 -->
    <sidebaritem  @toggleShow="updateFlag">
      <!-- 居家好物体 -->
      <template #homecontent>
        <selectitem v-if="index==12" title="居家好物" desc="精选品质生活">
          <template #bannerimg>
            <img src="static/images/classify/home-good-banner-1x.png" class="bannerImg"/>
          </template>
          <template #homegood :title="homeGoodsArr.title">
            <griditem :homeArr="homeGoodsArr"></griditem>
          </template>
        </selectitem>
      </template>
    </sidebaritem>
  </div>
</template>
<script>
import sidebaritem from "./sideBarItem"; 
import selectitem from "./treeselectitem";
import {ReqClassifyData,ReqClassifyBanner} from '@/request/classifyapi'
import griditem from './griditem'
export default {
  components: {
    sidebaritem,
    selectitem,
    griditem
  },
  name: "classify",
  data() {
    return {
      value: "",
      isTrue:false,
      index:"",
      homeGoodsArr:[],  //这个是拿来装家具好物的数据
    };
  },
  mounted() {
    ReqClassifyData().then(res=>{
      this.homeGoodsArr = res[13]["goodsList"]; //家居好物数据
    }).catch(err=>{console.log(err);})
  },
  methods: {
    updateFlag(arg) {
      this.index = arg;
    },
  },
};
</script>

<style lang="less" scoped>
</style>
